package cn.zhf.shop.controller;

import cn.zhf.shop.entity.Message;
import cn.zhf.shop.entity.order.OrderDetail;
import cn.zhf.shop.service.OrderDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(tags = "客户端订单模块")
@RequestMapping("/client/order")
public class OrderDetailController {
    @Resource
    private OrderDetailService orderDetailService;

    @GetMapping("/detail")
    @ApiOperation(value = "根据订单编号查询订单细节列表")
    public Message<List<OrderDetail>> getByOrderId(String orderId){
        return orderDetailService.getByOrderId(orderId);
    }

    @GetMapping("/detail/append")
    @ApiOperation(value = "根据订单编号查询订单细节列表")
    public Message<?> appendDetail(OrderDetail orderDetail){
        return orderDetailService.insert(orderDetail);
    }


}
